<include file="public@header" />
<link rel="stylesheet" href="__TMPL__/public/assets/css/bootstrap-grid.min.css">
<link rel="stylesheet" href="__TMPL__/public/assets/css/zoomify.min.css">
</head>
<body>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li class="active"><a href="{:url('Commodity/index')}">店铺商品</a></li>
		</ul>
		<form class="well form-inline margin-top-20" method="post" action="{:url('Commodity/index')}">
            商品名:
         <input type="text" class="form-control" name="g_goodsname" style="width: 120px;" value="{:input('request.g_goodsname/s','')}" placeholder="请输入商品名">
	店铺：
			<select class="form-control" name="storeid" style="width: 140px;">
				<option value="0">全部</option>
				<foreach name="stort" item="stort">
					<if condition="$storeid eq $stort.id">
					<option selected value='{$stort.id}'>{$stort.store_name}</option>
					<else/>
					<option  value='{$stort.id}'>{$stort.store_name}</option>
					</if>
				</foreach>
			</select> &nbsp;&nbsp;
			 <input type="submit" class="btn btn-primary" value="搜索" />
	         <a class="btn btn-danger" href="{:url('Commodity/index')}">清空</a>
	         <if condition="$special eq 1">
	         <a class="btn btn-success" href="{:url('PrivateGoods/add')}">添加商品</a>
	         </if>
        </form>
		<table class="table table-hover table-bordered">
			<thead>				
				<tr>
					<th width="40">ID</th>
					<th align="left">商品名称</th>
					<th align="left">所属类别</th>
					<th align="left">品牌</th>
					<th align="left">店铺</th>
					<th align="left">原价</th>
					<th align="left">会员价格</th>
					<th align="left">图片</th>
					<th align="left">状态</th>
					<th width="210">操作</th>
				</tr>
			</thead>
			<tbody id="con">
				<foreach name="data" item="vo">				
				<tr>
					<td>{$vo.g_id}</td>
					<td>{$vo.g_goodsname}</td>
					<td>{$vo['g_category']|getCname}</td>
					<td>{:get_brand($vo['brandid'],'name')}</td>
					<td>{:get_store_data($vo['storeid'],'store_name')}</td>
					<td>{$vo['g_price']}</td>
					<td>{$vo['g_vipprice']}</td>
					<td>
						<div class="example col-xs-6 col-md-6">
						<p><img src="__ROOT__/upload/{$vo.g_pic}" class="img-rounded" alt="" width='50' height='50'></p>
						</div>
					</td>
					<td>
					<if condition="$vo.g_status eq 0">
						<span style="color: red"> {$vo.status_name}</span>
					<else/>
						<span> {$vo.status_name}</span>
					</if>
					</td>
					<td>
						<if condition="$vo.g_status eq 1">
							<a  href='{:url("commodity/upStatus",array("g_id"=>$vo.g_id,"g_status"=>0,"storeid"=>$storeid,"page"=>$pages,"g_goodsname"=>$g_goodsname))}'><input type="hidden" class="g_id" value="{$vo.g_id}"/><input type="hidden" class="g_status" value="0"/>下架</a>
						<else/>
						    <a  href='{:url("commodity/upStatus",array("g_id"=>$vo.g_id,"g_status"=>1,"storeid"=>$storeid,"page"=>$pages,"g_goodsname"=>$g_goodsname))}' ><input type="hidden" class="g_id" value="{$vo.g_id}"><input type="hidden" class="g_status" value="1">上架</a>
						</if>
						<if condition="($isdianzhang neq 1)">
							<a href="{:url('Commodity/edit',array('g_id'=>$vo['g_id'],'g_goodsname'=>$g_goodsname,'storeid'=>$storeid))}">{:lang('EDIT')}</a>
						<else/>
							<if condition="($isdianzhang eq 1) and ($special eq 1)">
								<a href="{:url('Commodity/edit',array('g_id'=>$vo['g_id'],'g_goodsname'=>$g_goodsname,'storeid'=>$storeid))}">{:lang('EDIT')}</a>
							</if>
						</if>
					</td>
				</tr>
				</foreach>
			</tbody>
		</table>
		<div class="pagination">{$page}</div>
	</div>
	<script src="__TMPL__/public/assets/js/zoomify.min.js"></script>
	<script type="text/javascript">
		$('.example img').zoomify();
	</script>
	<script src="__STATIC__/js/admin.js"></script>
	<script>
       $('#con').on('click','.xj',function () {
           var g_id=$(this).find('.g_id').val();
           var g_status=$(this).find('.g_status').val();
           $.post('{:url("commodity/upStatus")}',{g_id:g_id,g_statsu:g_status},function(date){
               if(date.msg.con == 1)
			   {
			       alert("修改成功！");
			   }else{
                   alert('修改失败！');
			   }
		   },'json')
       })
	</script>
</body>
</html>